<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <title>机构管理</title>
    <%@ include file="../common/meta.jsp" %>
    <%@ include file="../common/common-body.jsp" %>
    <link href="${ctx}/css/page/common-list.css?t=${now}" rel="stylesheet">
    <link href="${ctx}/css/page/common-search.css?t=${now}" rel="stylesheet">
    <link href="${ctx}/css/plugins/note/note.css?t=${now}" rel="stylesheet">
    <script src="${ctx}/js/plugins/note/note.js?t=${now}"></script>
    <%@ include file="../common/common-body.jsp" %>
    <script src="${ctx}/js/common/common-body.js?t=${now}"></script>
    <link href="${ctx}/css/common-body.css?t=${now}" rel="stylesheet">
    <style>
        .reasonCheckLabel{
            display: block;
        }
    </style>
    <script>
        var statusMap = ${statusMap};
        var dataStatusMap = ${dataStatusMap};
        var searchInfo = ${searchInfo};
        <%--var AppType = ${AppType};--%>
    </script>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight" id="vue">
    <div class="tabs-container">
        <ul class="nav nav-tabs">
            <c:if test="${not empty searchInfo && searchInfo.isOrgExist == 1}">
                <li class="">
                    <a href="${ctx}/bizApp/orgPage?isTeamExist=${not empty searchInfo ? searchInfo.isTeamExist : 1}&isDocExist=${not empty searchInfo ? searchInfo.isDocExist : 1}" aria-expanded="true">服务机构</a>
                </li>
            </c:if>
            <li class="active">
                <a href="${ctx}/bizApp/teamPage?isOrgExist=${not empty searchInfo ? searchInfo.isOrgExist : 1}&isDocExist=${not empty searchInfo ? searchInfo.isDocExist : 1}" aria-expanded="true">机构团队</a>
            </li>
            <c:if test="${not empty searchInfo && searchInfo.isDocExist == 1}">
                <li class="">
                    <a href="${ctx}/bizApp/docPage?isOrgExist=${not empty searchInfo ? searchInfo.isOrgExist : 1}&isTeamExist=${not empty searchInfo ? searchInfo.isTeamExist : 1}" aria-expanded="true">机构专家</a>
                </li>
            </c:if>
        </ul>
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5><i class="fa fa-search"></i> 筛选查询</h5>
                </div>
                <div class="ibox-content ibox-content-search">
                    <form class="form-horizontal m-t" id="searchForm" novalidate="novalidate">
                        <div class="form-group">
                            <label class="col-sm-1 control-label">查询团队：</label>
                            <div class="col-sm-4">
                                <input type="text" name="teamName" onkeydown="if(event.keyCode==13){doRefresh();return false;}"
                                       id="teamName" class="form-control"  placeholder="输入团队名称" maxlength="30"
                                       value="${not empty searchInfo ? searchInfo.teamName : ''}">
                            </div>
                            <label class="col-sm-1 control-label">团队长：</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input type="hidden" id="docCode" name="docCode" value="${not empty searchInfo ? searchInfo.docCode : ''}">
                                    <input type="text" id="docName" name="docName" class="form-control" placeholder="请输入团队长名字" :value="teamObj.docName">
                                    <div class="input-group-btn">
                                        <button type="button" class="btn btn-default dropdown-toggle mySearchBtn" data-toggle="dropdown">
                                            <span class="caret"></span>
                                        </button>
                                        <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                        </ul>
                                    </div>
                                </div>
                            </div>
                            <div class="ibox-tools ibox-tools-search">
                                <button type="button" class="btn btn-primary btn-outline" onclick="doRefresh()">查询</button>
                                <button type="button" class="btn btn-primary btn-outline" onclick="clearFrom('searchForm')">重置</button>
                                <button type="button" class="btn btn-primary btn-outline" onclick="openSearchTools();"><i class="fa fa-caret-down"></i></button>
                            </div>
                        </div>
                        <div class="search-tools">
                            <div class="form-group">
                                <label class="col-sm-1 control-label">发布状态：</label>
                                <div class="col-sm-2">
                                    <select class="form-control" name="status" id="status" onchange="doRefresh()">
                                        <option value="">--请选择--</option>
                                        <c:forEach items="${statusMap}" var="item">
                                            <option value="${item.key}" ${not empty searchInfo && searchInfo.status == item.key? 'selected' : '' } >${item.value}</option>
                                        </c:forEach>
                                    </select>
                                </div>
                                <label class="col-sm-1 control-label">数据状态：</label>
                                <div class="col-sm-2">
                                    <select class="form-control" name="dataStatus" id="dataStatus" onchange="doRefresh()">
                                        <option value="">--请选择--</option>
                                        <c:forEach items="${dataStatusMap}" var="item">
                                            <c:if test="${item.key!='delete'}">
                                                <option value="${item.key}" ${not empty searchInfo && searchInfo.dataStatus == item.key? 'selected' : '' } >${item.value}</option>
                                            </c:if>
                                        </c:forEach>
                                    </select>
                                </div>
                                <label class="col-sm-1 control-label">创建日期：</label>
                                <div class="col-sm-3">
                                    <input placeholder="开始时间-结束时间" class="form-control layer-date" value="${not empty searchInfo ? searchInfo.timeInterval : ''}" id="timeInterval" name="timeInterval">
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-3">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <div class="input-group">
                        <input type="text" class="form-control" id="orgName" name="orgName"
                               value="${not empty searchInfo ? searchInfo.searchKey : ''}"
                               onkeydown="if(event.keyCode==13){doOrgRefresh();return false;}" placeholder="输入机构名称" >
                        <span class="input-group-btn">
                            <button type="button" onclick="doOrgRefresh()" class="btn btn-white">查询</button>
                        </span>
                    </div>
                </div>
                <div class="ibox-content">
                    <table class='table table-striped table-hover'
                           id="orgTable" data-height="370"
                           <%--data-height="400px"--%>
                           data-toggle="table"
                           data-url="${ctx}/bizOrgTeam/pageFindOrgData?t=${now}"
                           data-pagination="true"
                           data-side-pagination="server"
                           data-striped="true"
                           data-response-handler="handleServerResult"
                           data-query-params-type=""
                           data-query-params="getOrgParams"
                           data-page-number="${not empty searchInfo.orgPageNo ? searchInfo.orgPageNo : 1}"
                           data-page-size="${not empty searchInfo.orgPageSize ? searchInfo.orgPageSize : defaultPageSize}"
                           data-page-list="${pageList}">
                        <thead>
                        <tr>
                            <th data-field="orgCode" data-visible="false">机构编码</th>
                            <th data-field="isvPid" data-visible="false">isv</th>
                            <th data-field="orgName"  data-align="center" data-formatter="initCheck">机构名称</th>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
        <div class="col-sm-9">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5><i class="fa fa-table"></i> 团队列表</h5>
                    <div class="ibox-tools col-sm-offset-2">
                        <c:if test="${userType == 'super' || not empty btnMap['addTeam']}">
                            <%--<button class="btn btn-primary btn-outline" onclick="add('add')">新增</button>--%>
                            <button class="btn btn-primary btn-outline" onclick="openAddOrgTeamPage()">新增</button>
                        </c:if>
                        <c:if test="${userType == 'super' || not empty btnMap['editTeam']}">
                            <%--<button class="btn btn-primary btn-outline" onclick="add('edit')">编辑</button>--%>
                            <button class="btn btn-primary btn-outline" onclick="openEditOrgTeamPage()">编辑</button>
                        </c:if>
                        <c:if test="${userType == 'super' || not empty btnMap['commitTeam']}">
                            <button class="btn btn-primary btn-outline" onclick="doOpenQrCode()">提交发布</button>
                        </c:if>
                        <c:if test="${userType == 'super' || not empty btnMap['revokeTeam']}">
                            <button class="btn btn-primary btn-outline" onclick="doRevokeTeam()">撤销发布</button>
                        </c:if>
                        <%--<c:if test="${userType == 'super' || not empty btnMap['stateTeam']}">
                            <button class="btn btn-primary btn-outline change_text" onclick="change()">冻结</button>
                        </c:if>--%>
                        <c:if test="${userType == 'super' || not empty btnMap['delTeam']}">
                            <button class="btn btn-primary btn-outline" onclick="del()">删除</button>
                        </c:if>
                        <c:if test="${userType == 'super' || not empty btnMap['exportTeam']}">
                            <button class="btn btn-primary btn-outline" onclick="doExportExcel()">导出</button>
                        </c:if>
                        <button class="btn btn-primary btn-outline" onclick="doRefresh()">刷新</button>
                    </div>
                </div>
                <div class="ibox-content">
                    <table class='table table-striped table-hover'
                           id="dataTable"   data-height="370"
                           data-toggle="table"
                           data-url="${ctx}/bizOrgTeam/pageFindBizOrgTeam?t=${now}"
                           data-pagination="true"
                           data-side-pagination="server"
                           data-striped="true"
                           data-response-handler="handleServerResult"
                           data-query-params-type=""
                           data-query-params="getParams"
                           data-page-number="${not empty searchInfo.pageNo ? searchInfo.pageNo : 1}"
                           data-page-size="${not empty searchInfo.pageSize ? searchInfo.pageSize : defaultPageSize}"
                           data-page-list="${pageList}">
                        <thead>
                        <tr>
                            <th data-field="id" data-visible="false">主键id</th>
                            <th data-field="orgCode" data-visible="false">机构编码</th>
                            <th data-field="teamCode" data-visible="false">团队编码</th>
                            <th data-field="status" data-width="90px" data-align="center" data-formatter="formatStatus">发布状态</th>
                            <th data-field="dataStatus" data-width="90px" data-align="center" data-formatter="formatDataStatus">数据状态</th>
                            <th data-field="teamName" data-width="200px" data-align="center" data-formatter="formatName" data-events="actionEvents">团队名称</th>
                            <th data-field="roleLeaderName" data-width="100px" data-align="center" >团队长</th>
                            <th data-field="sortNum" data-width="80px" data-align="center">排序</th>
                            <th data-field="creator" data-width="100px" data-align="center"  data-formatter="formatterCreator">创建人</th>
                            <th data-field="operator" data-width="100px" data-align="center" data-formatter="formatterOperator">编辑人</th>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-12">
            <div class="text-center">${companyName}</div>
        </div>
    </div>
    </div>
</div>

<div id="addPage" class="modal" tabindex="-1" role="dialog" data-backdrop="static" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 id="_modelTitle" style="text-align: center; font-weight: normal;">{{obj.title}}</h4>
            </div>
            <div class="modal-body modal-body-height">
                <h4><i class="fa fa-table"></i> 基本信息</h4>
                <hr>
                <form class="form-horizontal m-t" id="_teamForm">
                    <div class="form-group">
                        <label class="col-sm-2 text-right">机构名称:</label>
                        <label class="col-sm-10  text-left">{{obj.orgName}}</label>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 text-right"><span style="color: red">*</span>团队名称:</label>
                        <div class="col-sm-8">
                            <input type="hidden" name="id" v-model="obj.id">
                            <input type="text" class="form-control" name="teamName" v-model="obj.teamName" required  minlength="1">
                        </div>
                        <div class="tip">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 text-right">排序:</label>
                        <div class="col-sm-8">
                            <input type="text" class="form-control" name="sortNum" isPInteger="true" onkeyup="this.value=this.value.replace(/\D/g,'')" maxlength="10" v-model="obj.sortNum">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label divNote">团队角色：
                       <button type="button"  class="buttonNote btn btn-white btn-xs" onclick="selectRole()">添加角色</button>
                           </label>
                        <div class="col-sm-8">
                            <div class="note" name="role" readonly="true">
                                <%--<div class="note_lable" name="role" :value="cell.enumName" v-for="cell in obj.bizEnumList">--%>
                                    <%--<lable>{{cell.enumName}}</lable>--%>
                                    <%--<div  onclick="$(this).parent().remove()">X</div>--%>
                                    <%--<div  class="note_mind"></div>--%>
                                <%--</div>--%>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 text-right">团队介绍:</label>
                        <div class="col-sm-8">
                            <textarea  name="teamIntroduction" class="form-control" style="height: 100px; resize: none; width: 100%;" v-model="obj.teamIntroduction"></textarea>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer"  style="text-align: center;">
                <button class="btn btn-primary" onclick="dosave()">保存</button>
                <button class="btn btn-white" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>


<div id="selectRole" class="modal" tabindex="-1" role="dialog" data-backdrop="static" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <div class="modal-header text-center">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 >新增角色</h4>
            </div>
            <div class="modal-body">
                <form action="" id="note">
               <div class="row">
                   <input type="text" class="form-control" id="addNote" maxlength="20" placeholder="请输入角色名称" required minlength="1">
               </div>
                </form>
            </div>
            <div class="modal-footer text-center" >
                <button class="btn btn-primary" onclick="dosaveRole()">保存</button>
                <button class="btn btn-white" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>

<div id="setReasonPage" class="modal" tabindex="-1" role="dialog" data-backdrop="static" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 style="text-align: center; font-weight: normal;">撤销发布</h4>
            </div>
            <div class="modal-body modal-body-height">
                <form class="form-horizontal m-t" id="_tipForm">
                    <div class="form-group">
                        <label class="col-sm-12 control-label" style="text-align: left;"><span style="color: red">*</span>请输入<span id="_modelTip">撤销发布</span>原因：</label>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-12">
                            <c:forEach items="${reasonMap}" var="item">
                                <label class="reasonCheckLabel"><input type="checkbox" name="_reason" value="${item.name}">${item.name}</label>
                            </c:forEach>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-12">
                            <textarea id="reason" name="reason" maxlength="1000" style="height: 100px; resize: none; width: 100%;"></textarea>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer" style="text-align: center;">
                <button class="btn btn-primary" onclick="doSaveReason()">保存</button>
                <button class="btn btn-white" onclick="closeSetReasonPage();">取消</button>
            </div>
        </div>
    </div>
</div>

<div id="scanQrCodePage" class="modal" tabindex="-1" role="dialog" data-backdrop="static" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <div class="modal-header text-center">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4>扫码预览</h4>
            </div>
            <div class="modal-body modal-body-height">
                <div class="row">
                    <div class="col-sm-12 text-center"><image class="login-scancode" id="scanCode" style="height: auto; width: 250px"/></div>
                    <div class="col-sm-12 text-center">提示：验证发布内容准确性，上线更放心</div>
                    <div class="col-sm-12 text-center">二维码有效期为<span id="_validNum"></span>秒</div>
                </div>
            </div>
            <div class="modal-footer" style="text-align: center;">
                <button class="btn btn-info" onclick="doCommitTeam()">提交发布</button>
                <button class="btn btn-white" onclick="$('#scanQrCodePage').modal('hide')">取消</button>
            </div>
        </div>
    </div>
</div>

<script src="${ctx}/js/org/orgTeamMgr.js?t=${now}"></script>
</body>
</html>

